<?php include _include(APP_PATH.'view/htm/header.inc.htm');?>

<!--{hook search_start.htm}-->

<div class="row">
	<div class="col-lg-10 mx-auto">
		<div class="card">
			<div class="card-body">
				<form action="<?php echo url('search');?>" id="form">
				
					<div class="input-group mb-3">
						<input type="text" class="form-control" placeholder="<?php echo lang('keyword');?>" name="keyword" value="<?php echo $keyword_decode;?>">
						<div class="input-group-append">
							<button class="btn btn-primary" type="submit" id="submit"><?php echo lang('search');?></button>
						</div>
					</div>
				
					<?php if($search_type == 'like' || $search_type == 'fulltext') { ?>
					<div class="form-group">
						<?php if($search_range == 0 || $search_range == 1) { ?>
						<label class="form-check-inline">
						<input class="form-check-input" type="radio" name="range" value="1" <?php echo $range == '1' ? 'checked' : '';?>> 主题贴
						</label>
						<?php } ?>
	
						<?php if($search_range == 0 || $search_range == 2) { ?>
						<label class="form-check-inline">
							<input class="form-check-input" type="radio" name="range" value="0" <?php echo $range == '0' ? 'checked' : '';?>> 所有贴
						</label>
						<?php } ?>
					</div>
					<?php } ?>
				</form>
			</div>
		</div>

		<?php if($keyword) { ?>

		<?php if($range == 1) { ?>

		<?php if($threadlist) { ?>
		
		<div class="card">
			<div class="card-header">
				<ul class="nav nav-tabs card-header-tabs">
					<li class="nav-item">
						<a class="nav-link <?php echo $active == 'default' ? 'active' : '';?>" href="./">
							<?php echo lang('thread_list');?>
						</a>
					</li>
					<!--{hook search_thread_list_nav_item_after.htm}-->
				</ul>
			</div>
			<div class="card-body">
				<ul class="list-unstyled threadlist mb-0">
					<!--{hook search_threadlist_before.htm}-->
					<?php include _include(APP_PATH.'view/htm/thread_list.inc.htm');?>
					<!--{hook search_threadlist_after.htm}-->
				</ul>
			</div>
		</div>
		
		<?php } else { ?>
		
		<div class="card">
			<div class="card-body">
				无结果
			</div>
		</div>
		
		<?php } ?>
		
		<?php include _include(APP_PATH.'view/htm/thread_list_mod.inc.htm');?>
		
		<!--{hook search_page_before.htm}-->
		<?php if($pagination) { ?>
		<nav><ul class="pagination justify-content-center"><?php echo $pagination; ?></ul></nav>
		<?php } ?>
		<!--{hook search_page_end.htm}-->

		<?php } elseif($range == 0) { ?>

		<div class="card">
			<div class="card-body">
				<div class="card-title">
					<div class="media">
						<div>
							<?php echo lang('post_list');?>
						</div>
						<div class="media-body text-right">
							<!--{hook search_post_list_title_right.htm}-->
						</div>
					</div>
				</div>
				<ul class="list-unstyled postlist">
						<!--{hook search_postlist_before.htm}-->
						<?php include _include(APP_PATH.'view/htm/post_list.inc.htm'); ?>
						<!--{hook search_postlist_before.htm}-->
				</ul>
			</div>
		</div>

		<?php } ?>
		<?php } ?>
	</div>
	<div class="col-lg-3 hidden-sm hidden-md">
		<!--
		<div class="card card-body">
			<h4 class="card-title">筛选条件</h4>
		</div>
		-->
	</div>
</div>

<!--{hook search_end.htm}-->

<?php include _include(APP_PATH.'view/htm/footer.inc.htm');?>

<script>
var jform = $('#form');
var jsubmit = $('#submit');
var jrange = jform.find('input[name="range"]');
var jkeyword = jform.find('input[name="keyword"]');
jform.on('submit', function() {
	var range = jrange.checked();
	var keyword = jkeyword.val();
	window.location = xn.url('search-' + xn.urlencode(keyword) + '-' + range);
	return false;
});

$('#nav_pc li[fid="<?php echo $fid;?>"]').addClass('active');
</script>



<!--{hook search_js.htm}-->